package com.carey.blog.sync;

/**
 * Article remote management via <a
 * href="http://www.xmlrpc.com/metaWeblogApi">MetaWeblog</a> blog.
 * 
 */
public interface MetaWeblog extends Blog {

	/**
	 * Gets API address with the specified user name.
	 * 
	 * @return API address, for example, {@code http://blog.csdn.net/$userName}
	 *         /services/metablogapi.aspx}
	 */
	String getApiAddress();

	/**
	 * Gets a post from a MetaWeblog blog with the specified parameters.
	 * 
	 * @param postId
	 *            the specified post id
	 * @return blog post, returns {@code null} if occurs error or not found
	 * @throws SyncException
	 *             sync exception
	 */
	Post getPost(final String postId) throws SyncException;

	/**
	 * Deletes a post from a MetaWeblog blog with specified parameters.
	 * 
	 * @param postId
	 *            the specified post id
	 * @throws SyncException
	 *             sync exception
	 */
	void deletePost(final String postId) throws SyncException;

	/**
	 * Creates a post to a MetaWeblog blog with specified parameters.
	 * 
	 * @param metaWeblogPost
	 *            the specified blog post
	 * @return post id just created
	 * @throws SyncException
	 *             sync exception
	 */
	String newPost(final Post metaWeblogPost) throws SyncException;

	/**
	 * Updates a post specified by the given post id to MetaWeblog blog with
	 * specified parameters.
	 * 
	 * @param postId
	 *            the given post id
	 * @param metaWeblogPost
	 *            the specified blog post to update
	 * @throws SyncException
	 *             sync exception
	 */
	void editPost(final String postId, final Post metaWeblogPost)
			throws SyncException;
}
